﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace LastoRevival.Website
{
	public static class EnumExtensions
	{

		public static IEnumerable<T> GetAllValues<T>(this T e) where T : struct, IConvertible
		{
			if (!typeof(T).IsEnum)
			{
				throw new ArgumentException("T must be an enumerated type");
			}

			var values = new List<T>();

			foreach (var value in Enum.GetValues(e.GetType()))
			{
				values.Add((T)value);
			}

			return values;
		}

	}
}